package com.yohann.designPattern.decorator.condiment;

import com.yohann.designPattern.decorator.coffee.Drink;

/**
 * <p>
 * 装饰者(调料)
 * </p>
 *
 * @author Yohann
 * @since 2021/2/7 15:15
 */
public class Decorator extends Drink {
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public Float cost() {
        return super.getPrice() + drink.cost();
    }

    @Override
    public String getDescription() {
        return drink.getDescription() + " && " + super.getDescription() + " " + super.getPrice();
    }
}